/*
 Xern Entity Relocation Network
 Copyright (C) 2010-2011 Ronie Salgado <roniesalg@gmail.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
*/

#ifndef XERN_SCENENODE_HPP
#define XERN_SCENENODE_HPP

#include <boost/enable_shared_from_this.hpp>
#include <OgreRoot.h>
#include "Xern/ISceneNode.hpp"

namespace XernOgre
{
	using namespace Xern;

	class SceneNode: public ISceneNode,
		public boost::enable_shared_from_this<SceneNode>
	{
	public:
		SceneNode(Ogre::SceneManager *scene, Ogre::SceneNode *node);
		~SceneNode();

		virtual ResourceFlags GetFlags() const;
		virtual void UpdateState(boost::shared_ptr<IDataFilter> stateData);

		virtual const uuid &GetId() const;
		virtual void SetId(const uuid &id);

		virtual void AddChild(boost::shared_ptr<ISceneNode> node);
		virtual void RemoveChild(boost::shared_ptr<ISceneNode> node);

		virtual void AttachObject(boost::shared_ptr<IMovableObject> object);
		virtual void DetachObject(boost::shared_ptr<IMovableObject> object);

		virtual void SetTransform(const ReversibleTransform &transform);
		virtual const ReversibleTransform &GetTransform() const;

	private:
		uuid id;
		Ogre::SceneManager *scene;
		Ogre::SceneNode *onode;
		ReversibleTransform transform;
	};
};

#endif //XERN_SCENENODE_HPP
